#ifndef _ODN_GFX_MESH_H
#define _ODN_GFX_MESH_H

//Engine headers 
#include "odn_gfx_Renderer.h"
#include "odn_gfx_Triangle.h"

//Standard library headers 
#include <vector>

namespace ouden
{
	namespace gfx
	{
		
		//A mesh contains a bunch of triangles and is graphical only 
		class ODN_Mesh
		{
			
		public:
			
			//TODO: Clean up function 
			bool Draw();
			
			//Load a mesh from a file 
			bool loadMesh()
			{
				
				vertices = new ODN_Vertex[3];
				
				vertices[0].pos = Vector3D(-100, 0);
				vertices[0].color = RGBAColor(1, 1, 1, 1);
				vertices[0].normal = Vector3D(0, 0, -1);
				vertices[1].pos = Vector3D(100, 0);
				vertices[1].color = RGBAColor(1, 1, 1, 1);
				vertices[1].normal = Vector3D(0, 0, -1);
				vertices[2].pos = Vector3D(0, 100);
				vertices[2].color = RGBAColor(1, 1, 1, 1);
				vertices[2].normal = Vector3D(0, 0, -1);
				
				texture = 0;
				
				trianglecount = 1;
				
				triangles = new ODN_Triangle();
				
				triangles[0].vertexindices[0] = 0;
				triangles[0].vertexindices[1] = 1;
				triangles[0].vertexindices[2] = 2;
				
			}
			
			~ODN_Mesh()		{ delete [] vertices; delete [] triangles; }
			
			//Property access functions 
			void setTexture(GLuint Texture)	{ texture=Texture; }
			GLuint getTexture()				{ return texture; }
			
		private:
			
			//Property variables 
			GLuint texture;		//A mesh can use only one texture but texture coordinates can be used to vary it 
			
			//Number of triangles 
			int trianglecount;
			
			//Array of triangles with vertex indices 
			ODN_Triangle* triangles;
			//Array of triangles that make up the mesh 
			//std::vector<ODN_Triangle> triangles;
			
			//Array of vertices 
			ODN_Vertex* vertices;
			
		};
		
	} //namespace gfx 
} //namespace ouden 

#endif //_ODN_GFX_MESH_H
